using SharpGraphT.Graph.Builder;
using SharpGraphT.Util;

namespace SharpGraphT.Graph;

public class SimpleGraph<TV, TE> : AbstractBaseGraph<TV, TE>
    where TE : class, new() {
    private static readonly long SerialVersionUid = 4607246833824317836L;

    public SimpleGraph() :
        this(null, SupplierUtil.CreateSupplier<TE>(), false) { }

    public SimpleGraph(Func<TV> vertexSupplier, Func<TE> edgeSupplier,
        bool weighted) : base(vertexSupplier, edgeSupplier,
        new DefaultGraphType.Builder().Undirected().AllowMultipleEdges(false)
            .AllowSelfLoops(false).Weighted(weighted).Build()) { }

    public static GraphBuilder<TV, TE, SimpleGraph<TV, TE>> CreateBuilder() =>
        new(new SimpleGraph<TV, TE>());

    public static GraphBuilder<TV, TE, SimpleGraph<TV, TE>>
        CreateBuilder(Func<TE> edgeSupplier) =>
        new(new SimpleGraph<TV, TE>(null, edgeSupplier, false));
}